package com.tristia.entity.util;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import com.tristia.dao.GenericDao;
import com.tristia.entity.State;

public class StateDataLoader {
	private List<State> states = new ArrayList<State>();
	@Resource
	GenericDao<State, Long> stateDao;
	
	public void loadData() {
		for (State state : states) {
			stateDao.save(state);
		}
		states.clear();
		states = null;
	}

	public void setStates(List<State> states) {
		this.states = states;
	}
	
	public void init() {
		loadData();
	}
}
